//
//  SINASubClassModel.m
//  sinashebao
//
//  Created by  androidlongs on 2018/3/6.
//  Copyright © 2018年  androidlongs. All rights reserved.
//

#import "SINASubClassModel.h"
#import "SINACalendarUtils.h"

@implementation SINASubClassModel
-(instancetype)initWithDict:(NSDictionary *)result{
    if (self=[super init]) {
        /*
         
         "subjectname": "语文",
         "name": "数学学院数学系高数1班",
         "students": 30,
         "subjectid": 7
         
         */
       
        _subjectname=result[@"subjectname"];
        _name=result[@"name"];
        _students=result[@"students"];
        _subjectid=result[@"subjectid"];
         _classifyname=result[@"classifyname"];
        
        NSString *lati=result[@"lati"];
        if (lati!=nil) {
            _courseLocationLat=[lati doubleValue];
        }
        
        NSString *lon=result[@"lon"];
        if (lon!=nil) {
             _courseLocationLon=[lon doubleValue];
        }
        
        NSString *ishasStr=result[@"ishas"];
        if (ishasStr!=nil) {
            _ishas = [ishasStr integerValue];
        }
       
        
        _signTime =result[@"time"];
        if (_signTime==nil) {
            _signTime=@"0";
        }
        
        /*
         
         {
         "score": 99.5,
         "uuid": "fef0ee3efd18489881623ed1asfas4",
         "realname": "周润发",
         "status": "1001"
         }
         */
        _score=[result[@"score"] integerValue];
        _uuid=result[@"uuid"];
        _realname=result[@"realname"];
        _status=result[@"status"];
        
        
        /*
         {"classifyid":6,
         "name":"数学学院数学系高数1班",
         "classifyname"："高数1班",
         "students":30}
         */

        _classifyid=result[@"classifyid"];
        _classifyname=result[@"classifyname"];
        
        
        
        /*
         "buildname": "成教楼",
         "ischange": "0",
         "name": "高数",
         "syllabusid": 1,
         
         "searchdate": [50, 48, 49, 55, 45, 49, 49, 45, 51, 48],
         "endtime": "12:00:00 下午",
         "classroom": "304",
         "starttime": "10:00:00 上午",
         "syllabusclassid": 2
         */
        _buildname=result[@"buildname"];
        _ischange=result[@"ischange"];
        _syllabusid=result[@"syllabusid"];
        _endtime=result[@"endtime"];
        
        _classroom=result[@"classroom"];
        _starttime=result[@"starttime"];
        _syllabusclassid=result[@"syllabusclassid"];
        _searchdate =result[@"searchdate"];
        
        
        
        _classtime =result[@"classtime"];
        if (_classtime!=nil) {
            _classtimeyear=[SINACalendarUtils getDateStringWithTimeStr:_classtime andFormat:@"yyyy"];
            _classtimemon=[SINACalendarUtils getDateStringWithTimeStr:_classtime andFormat:@"MM"];
            _classtimeDay=[SINACalendarUtils getDateStringWithTimeStr:_classtime andFormat:@"dd"];
            
        }
        
        
        /*
         {
         "collegename": "数学学院",
         "collsystemname": "数学系",
         "realname": "周润发",
         "classifyname": "高数1班"
         }
         */
        _collegename=result[@"collegename"];;
        _collsystemname=result[@"collsystemname"];;
        
        
    }
    return self;
}
+(instancetype)userWithDict:(NSDictionary *)dict{
    return [[self alloc] initWithDict:dict];
}
@end
